import ReactDOM from 'react-dom'
import React from 'react'
import {
  hashHistory,
  Router,
  Route,
  IndexRedirect
} from 'react-router'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'

import App from '../views/App'
import NotFound from '../components/NotFound'
const Provider = require('react-redux').Provider
import configureStore  from '../store/configureStore';
const store = configureStore()
function validate(next, replace, callback) {
  //验证
  !!getCookie('token') == false && hashHistory.push('login')
  refreshCookie()
  callback()
}
ReactDOM.render(
  <Provider store={store}>
    <Router history={hashHistory} onEnter={validate}>
      <Route path="*" component={NotFound} />
    </Router>
  </Provider>, document.getElementById('root'))
